package com.ruoyi.common.core.domain;


import org.apache.commons.collections.iterators.ObjectGraphIterator;
import org.apache.poi.ss.formula.functions.T;

import java.util.List;

public class Ajax2Result {
    private int code;
    private String mag;
    private List<?> list;
    private Class<?> data;
    public Ajax2Result() {
    }

    public Ajax2Result(int code, String mag, Class<?> data) {
        this.code = code;
        this.mag = mag;
        this.data = data;
    }

    public Ajax2Result(int code, String mag, List<?> list) {
        this.code = code;
        this.mag = mag;
        this.list = list;
    }
    public Ajax2Result(int code, String mag) {
        this.code = code;
        this.mag = mag;
        this.list = list;
    }
    public static Ajax2Result data(Class<?> data){
        return new Ajax2Result(200,"数据返回成功",data);
    }

    public static Ajax2Result success(List<?> list){
        return new Ajax2Result(200,"数据返回成功",list);
    }
    public static Ajax2Result error(int code, String mag){
        return new Ajax2Result(500,(mag!=null & mag !=null)?mag:"");
    }
    public int getCode() {
        return code;
    }

    @Override
    public String toString() {
        return "Ajax2Result{" +
                "code=" + code +
                ", mag='" + mag + '\'' +
                ", list=" + list +
                '}';
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMag() {
        return mag;
    }

    public void setMag(String mag) {
        this.mag = mag;
    }

    public List<?> getList() {
        return list;
    }

    public void setList(List<?> list) {
        this.list = list;
    }
}
